 #include<arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>


in_addr_t my_inet_addr(const char *);
int main(int argc, char *argv[])
{
    char buf[1024] = {0};
    printf("input id:");
    fgets(buf, 1024, stdin);

    unsigned int addr;
    addr = 1;
    printf("it:%u\n", inet_addr(buf));

    printf("my:%u\n", my_inet_addr(buf));

    return 0;
}

in_addr_t my_inet_addr(const char *ip_str) {
  in_addr_t data;
  int place = 0;
  
  char* toke = strtok((char*)ip_str,".");
  while(toke != NULL)
  {
    data |= (atoi(toke) >> place);

    place += 8;
    toke = strtok(NULL,".");
  }


  return data;
}
